if (typeof wcomix == "undefined") {
	wcomix = {};
}
if (typeof wcomix.lang == "undefined") {
	wcomix.lang = {};
}
if (typeof wcomix.lang._translations == "undefined") {
	wcomix.lang._translations = {};
}

wcomix.lang.translate = function(key, data) {
	if (typeof data == "undefined") {
		data = {};
	}

	var pointer = "wcomix.lang._translations." + key;
	var out = "@" + key;
	if (typeof eval(pointer) != "undefined") {
		out = eval(pointer);

		for (var name in data) {
			var ptr = "data." + name;
			var value = eval(ptr);
			var regex = new RegExp("\{@" + name.toUpperCase() + "\}", "g");

			out = out.replace(regex, value);
		}

	} else {
		return key;
	}
	return out;
};
